class MinStack {
public:
    MinStack() {}
    
    void push(int val) {
        _st.push(val);
        if (_st_help.empty() || val < _st_help.top())
            _st_help.push(val);
        else
            _st_help.push(_st_help.top());
    }
    
    void pop() {
        _st_help.pop();
        _st.pop();
    }
    
    int top() {
        return _st.top();
    }
    
    int getMin() {
        return _st_help.top();
    }   
private:
    stack<int> _st;
    stack<int> _st_help;
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(val);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->getMin();
 */